﻿define([

], function () {

    var Model = Backbone.Model.extend({
        list: function (id, callbackOk) {
            send("user/List", { companyId: id }, null, callbackOk);
        },
        getUser: function (id, callbackOk) {
            send("user/Get/" + id, null, null, callbackOk);
        },
        update: function (data, callbackOk) {
            send("user/Update", data, { type: "PUT" }, callbackOk);
        },
        create: function (user, callbackOk) {
            send("user/Create", user, { type: "POST" }, callbackOk);
        },
        deleteData: function (id, callbackOk) {
            send("user/Delete/" + id, null, { type: "DELETE" }, callbackOk);
        },
        updateUserPreference: function (preferenceCode, value) {
            var param = {
                userCompanyId: __currentSession.userId,
                preferenceCode: preferenceCode,
                value : value
            };
            send("user/UpdateUserPreference", param, { type: "PUT" });
        },
        getUserPreference: function (preferenceCode, callback) {
            var param = {
                userCompanyId: __currentSession.userId,
                preferenceCode: preferenceCode,
            };
            send("user/GetUserPreference", param, { type: "GET" } , callback);
        },

    });
    return Model;
});